import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { SCrossSWObserveListGroupInfo } from "../../../../../Message/Public/SCrossSWObserveListGroupInfo";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { SCrossSWObserveListInfo } from "../../../../../Message/Public/SCrossSWObserveListInfo";
import { GameProxy } from "../../../mvc/GameProxy";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class AttachedSoulBattlefielListRenderer
    
    export  class AttachedSoulBattlefielListRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            if (typeof arg1 === "scrossswobservelistgroupinfo") 
            {
                this._vo = arg1 as SCrossSWObserveListGroupInfo;
                this._liftName.htmlText = EntityUtil.getProxyName(SCrossSWObserveListInfo(this._vo.vGroupYellow[0]).entityId) + SCrossSWObserveListInfo(this._vo.vGroupYellow[0]).name;
                this._rightName.htmlText = EntityUtil.getProxyName(SCrossSWObserveListInfo(this._vo.vGroupBlue[0]).entityId) + SCrossSWObserveListInfo(this._vo.vGroupBlue[0]).name;
            }
            return;
        }

        /* internal  */onGuardTxtLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            GameProxy.copy.enterCrossSpiritWar(this._vo.battlefieldId, false);
            return;
        }

        /* internal  */onLiftInfoLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AttachedSoulBattlefieldTeamInfoViewShow, this._vo.vGroupYellow));
            return;
        }

        /* internal  */onRightInfoLinkHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AttachedSoulBattlefieldTeamInfoViewShow, this._vo.vGroupBlue));
            return;
        }

        /* internal  */onLoadResHandler(): void
        {
            ObjCreate.createGBitmap(ImagesConst.AttachedSoulBattlefieldYellowSmallFlag, 33, 12, this);
            ObjCreate.createGBitmap(ImagesConst.AttachedSoulBattlefieldBlueSmallFlag, 422, 12, this);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createGBitmap(ImagesConst.ArenaVS, 350, 0, this);
            this._liftName = ObjCreate.createTextField("", 56, 18, 180, 20, this, GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat1, flash.text.TextFormatAlign.CENTER));
            this._liftInfo = ObjCreate.createTextField(HTMLUtil.addLink(Language.getString(28609), GlobalStyle.color4), 235, 18, 90, 20, this, null, true);
            this._rightName = ObjCreate.createTextField("", 440, 18, 180, 20, this, GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat1, flash.text.TextFormatAlign.CENTER));
            this._rightInfo = ObjCreate.createTextField(HTMLUtil.addLink(Language.getString(28609), GlobalStyle.color4), 613, 18, 90, 20, this, null, true);
            var loc1=ObjCreate.createTextField(HTMLUtil.addLink(Language.getString(28610), GlobalStyle.color2), 723, 18, 30, 20, this, null, true);
            loc1.addEventListener(flash.events.TextEvent.LINK, this.onGuardTxtLinkHandler);
            ObjCreate.createBg(0, 43, 785, 2, this, ImagesConst.SplitLine);
            this._liftInfo.addEventListener(flash.events.TextEvent.LINK, this.onLiftInfoLinkHandler);
            this._rightInfo.addEventListener(flash.events.TextEvent.LINK, this.onRightInfoLinkHandler);
            LoaderHelp.addResCallBack(ResFileConst.AttachedSoulBattlefield, this.onLoadResHandler);
            return;
        }

        /* internal */ /* var */_liftName: GTextFiled;

        /* internal */ /* var */_liftInfo: GTextFiled;

        /* internal */ /* var */_rightName: GTextFiled;

        /* internal */ /* var */_rightInfo: GTextFiled;

        /* internal */ /* var */_vo: SCrossSWObserveListGroupInfo;
    }
